from rest_framework import serializers

from plan_app.models import Plan,ClassType

class PlanSerializer(serializers.ModelSerializer):
    '''学习计划序列化器'''
    class Meta:
        model = Plan
        fields = '__all__'

class ClassTypeSerializer(serializers.ModelSerializer):
    '''班级类型序列化器'''
    course_name = serializers.CharField(source='course.name')
    course_icon = serializers.CharField(source='course.icon')

    class Meta:
        model = ClassType
        fields = '__all__'